package com.hxd.common.utils;

import java.lang.reflect.ParameterizedType;

public class GenericsUtils {

	public static <T> Class<T> getEntityClass(Class<?> clazz) {
        return getSuperClassGenricType(clazz, 1);
    }
 
    @SuppressWarnings("unchecked")
	public static <T> Class<T> getSuperClassGenricType(Class<?> clazz, int index) {
        return (Class<T>) ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments()[index];
    }
    
}
